<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="FLASK_DEMON">
    <meta name="author" content="HYY, and Bootstrap contributors">
    <meta name="generator" content="Config-Studio V1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <link rel="shortcut icon" href="{{ url_for('static', filename='pic/favicon.ico') }}">
    <title>{% block title %}{% endblock %}</title>
    <script src="{{ url_for('static', filename='js/jquery-3.5.1.js') }}"></script>
    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/vue.js') }}"></script>
    <script src="{{ url_for('static', filename='js/axios.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/feather.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/alerts.js') }}"></script>
    <script src="{{ url_for('static', filename='js/impress.js') }}"></script>
    <script src="{{ url_for('static', filename='js/jquery.datetimepicker.full.min.js') }}"></script>
    <script src='//recaptcha.net/recaptcha/api.js'></script>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='css/base.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='css/jquery.datetimepicker.min.css') }}">

    {% block head %}{% endblock %}
    <style>
        #main {
            margin-top: 16px;
        }
    </style>
</head>

<body style="overflow: hidden;">
    <!-- 顶部标题栏 -->
    <nav id='appbar' class="appbar navbar navbar-expand-md  sticky-top navbar-dark  bg-dark ">
        <a class="navbar-brand col-md-1 col-lg-1 mr-0 px-1" href="{{url_for('index')}}">
            安全隔离网关
        </a>
        <!-- <span data-feather="home" style="width: 24px; height: 24px;color: aliceblue;"></span> -->
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse"
            aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarCollapse">
            <ul class="navbar-nav mr-auto">

                <li class="nav-item active">
                    <a class="nav-link" href="javascript:void(0)" onclick="plus()">
                        <span data-feather="menu" style="width: 20px; height: 20px;color:white;"></span>

                    </a>
                </li>
            </ul>
            <button class="btn btn-outline-info " type="button" data-toggle="modal" data-target="#FAQ">
                FAQ
            </button>
            <button class="btn btn-outline-warning " type="button" data-toggle="modal" data-target="#loginModal">
                SIGN IN
            </button>
            <div class="dropdown mr-2">
                <button class="btn btn-outline-danger dropdown-toggle" type="button" id="dropdownMenuButton"
                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    {% if g.user %}
                    Welcome! {{g.user}}
                    {% else %}
                    未登录
                    {% endif %}
                </button>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                    {% if g.user %}
                    <a href="{{url_for('admin.profile')}}" class="dropdown-item">Profile</a>
                    <a href="{{url_for('auth.logout')}}" class="dropdown-item">Logout</a>
                    {% else %}
                    <a href="{{url_for('auth.login')}}" class="dropdown-item">Login</a>
                    {% endif %}
                </div>
            </div>
            <form class="form-inline mt-2 mt-md-0">
                <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
            </form>


        </div>
    </nav>

    <!-- 正文 -->
    <div class="container-fluid">
        <div class="row">

            <!-- 左边导航栏 -->
            <nav id="sidebar" class="d-md-block bg-light sidebar collapse p-0 ">

                <div class="d-flex justify-content-start bg-dark">
                    <img src="{{url_for('static',filename='pic/logo.png')}}" class="img-fluid p-0 m-0"
                        alt="Responsive image" style="height: 56px;" />
                </div>

                <div class="sidebar-sticky " style="background:rgba(129, 104, 104, 0.438);">
                    <ul id='open' class="nav flex-column ">

                        <h6
                            class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
                            <span> config setting</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">

                            </a>
                        </h6>

                        <a class="nav-link  {{opc}}" href="{{url_for('cs.opc')}}">
                            <span data-feather="circle" style="width: 24px; height: 24px;color:black;"></span>
                            opc
                        </a>


                        <a class="nav-link {{opc_da_server}} " href="{{url_for('cs.load_opc_se')}}">
                            <span data-feather="edit" style="width: 24px; height: 24px;color:black;"></span>
                            server
                        </a>


                        <a class="nav-link {{opc_da_client}} " href="{{url_for('cs.load_opc_da')}}">
                            <span data-feather="star" style="width: 24px; height: 24px;color:black;"></span>
                            da
                        </a>


                        <a class="nav-link {{opc_ae_client}}  " href="{{url_for('cs.load_opc_ae')}}">
                            <span data-feather="anchor" style="width: 24px; height: 24px;color:black;"></span>
                            ae
                        </a>


                        <a class="nav-link {{modbus_slave}} " href="{{url_for('cs.load_modbus')}}">
                            <span data-feather="octagon" style="width: 24px; height: 24px;color:black;"></span>
                            Modbus
                        </a>


                        <h6
                            class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
                            <span>config & tag review</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">
                                <span data-feather="settings"></span>
                            </a>
                        </h6>

                        <a class="nav-link {{config_review}} " href="{{url_for('cs.config_review')}} ">
                            <span data-feather="cpu" style="width: 24px; height: 24px;color:black;"></span>
                            Config
                        </a>


                        <a class="nav-link {{show_sensor}}" href="{{url_for('cs.show_sensor')}} ">
                            <span data-feather="file-text" style="width: 24px; height: 24px;color:black;"></span>
                            Sensor
                        </a>


                        <a class="nav-link {{control}}" href="{{url_for('cs.control')}} ">
                            <span data-feather="layers" style="width: 24px; height: 24px;color:black;"></span>
                            control
                        </a>


                        <a class="nav-link {{show_alarm}}" href="{{url_for('cs.show_alarm')}} ">
                            <span data-feather="bell" style="width: 24px; height: 24px;color:black;"></span>
                            Event
                        </a>


                        <a class="nav-link {{group}}" href="{{url_for('cs.show_tag_page')}} ">
                            <span data-feather="tag" style="width: 24px; height: 24px;color:black;"></span>
                            tag
                        </a>


                        <a class="nav-link {{modbus}}" href="{{url_for('mt.show_modbus_page')}} ">
                            <span data-feather="cast" style="width: 24px; height: 24px;color:black;"></span>
                            modbus
                        </a>


                        <h6
                            class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
                            <span>log & faq</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">

                            </a>
                        </h6>

                        <a class="nav-link {{log}}" href="{{url_for('cs.log')}} ">
                            <span data-feather="hard-drive" style="width: 24px; height: 24px;color:black;"></span>
                            Log
                        </a>



                        <a class="nav-link {{faq}}" href="{{url_for('faq.show_issue')}} ">
                            <span data-feather="info" style="width: 24px; height: 24px;color:black;"></span>
                            Faq
                        </a>

                    </ul>

                    <ul id='close' class="nav flex-column d-none text-center">

                        <h6
                            class="sidebar-heading mt-2 text-muted">
                            <span>setting</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report" >

                            </a>
                        </h6>

                        <a class="nav-link   {{opc}}" href="{{url_for('cs.opc')}}"  data-toggle="tooltip" data-placement="right" title="OPC SETTING">
                            <span data-feather="circle" style="width: 24px; height: 24px;color:black;"></span>
                        </a>


                        <a class="nav-link {{opc_da_server}} " href="{{url_for('cs.load_opc_se')}}" data-toggle="tooltip" data-placement="right" title="load_opc_se">
                            <span data-feather="edit" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{opc_da_client}} " href="{{url_for('cs.load_opc_da')}}" data-toggle="tooltip" data-placement="right" title="load_opc_da">
                            <span data-feather="star" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{opc_ae_client}}  " href="{{url_for('cs.load_opc_ae')}}" data-toggle="tooltip" data-placement="right" title="load_opc_ae">
                            <span data-feather="anchor" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{modbus_slave}} " href="{{url_for('cs.load_modbus')}}" data-toggle="tooltip" data-placement="right" title="load_modbus">
                            <span data-feather="octagon" style="width: 24px; height: 24px;color:black;"></span>
                           
                        </a>


                        <h6
                            class="sidebar-heading mt-2 text-muted">
                            <span>config</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">
                            </a>
                        </h6>

                        <a class="nav-link {{config_review}} " href="{{url_for('cs.config_review')}} " data-toggle="tooltip" data-placement="right" title="config_review">
                            <span data-feather="cpu" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{show_sensor}}" href="{{url_for('cs.show_sensor')}} " data-toggle="tooltip" data-placement="right" title="show_sensor">
                            <span data-feather="file-text" style="width: 24px; height: 24px;color:black;"></span>
                           
                        </a>


                        <a class="nav-link {{control}}" href="{{url_for('cs.control')}} " data-toggle="tooltip" data-placement="right" title="control">
                            <span data-feather="layers" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{show_alarm}}" href="{{url_for('cs.show_alarm')}} " data-toggle="tooltip" data-placement="right" title="show_alarm">
                            <span data-feather="bell" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{group}}" href="{{url_for('cs.show_tag_page')}} " data-toggle="tooltip" data-placement="right" title="show_tag_page">
                            <span data-feather="tag" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>


                        <a class="nav-link {{modbus}}" href="{{url_for('mt.show_modbus_page')}} " data-toggle="tooltip" data-placement="right" title="show_modbus_page">
                            <span data-feather="cast" style="width: 24px; height: 24px;color:black;"></span>
                          
                        </a>


                        <h6
                            class="sidebar-heading mt-2 text-muted">
                            <span>log</span>
                            <a class="d-flex align-items-center text-muted" href="#" aria-label="Add a new report">

                            </a>
                        </h6>

                        <a class="nav-link {{log}}" href="{{url_for('cs.log')}} " data-toggle="tooltip" data-placement="right" title="log">
                            <span data-feather="hard-drive" style="width: 24px; height: 24px;color:black;"></span>
                            
                        </a>



                        <a class="nav-link {{faq}}" href="{{url_for('faq.show_issue')}} " data-toggle="tooltip" data-placement="right" title="show_issue">
                            <span data-feather="info" style="width: 24px; height: 24px;color:black;"></span>
                           
                        </a>

                    </ul>
                </div>
            </nav>

            <!-- 正文-->
            <main id="main" class='main'>

                <div class="col-12" style="position: relative; overflow-y: auto; height: 724px;">
                    {% block heads %}{% endblock %}
                    {% block content %}{% endblock %}
                </div>

                <!-- 全局提示框 -->
                <div style="position: fixed;top: 60px;right: 30px;" id='alarm'></div>

                <!--页脚-->
                <div class="container-fluid p-0 m-0 ">
                    <hr class="border-top border-info" />
                    <div class="row justify-content-start text-center">
                        <div class="col-3 col-md">
                            <img class="mb-2" src="{{url_for('static',filename='pic/CL1.jpg')}}" alt="" width="100"
                                height="100">
                            <!-- <small class="d-block mb-3 text-muted">&copy; 2019-10-03</small> -->
                        </div>
                        <div class="col-3 col-md">
                            <h5>Features</h5>
                            <ul class="list-unstyled text-small">
                                <li><a class="text-muted" href="#">Cool stuff</a></li>
                                <li><a class="text-muted" href="#">Another one</a></li>

                            </ul>
                        </div>
                        <div class="col-3 col-md">
                            <h5>Resources</h5>
                            <ul class="list-unstyled text-small">
                                <li><a class="text-muted" href="#">Resource</a></li>
                                <li><a class="text-muted" href="#">Resource name</a></li>
                            </ul>
                        </div>
                        <div class="col-3 col-md">
                            <h5>About</h5>
                            <ul class="list-unstyled text-small">
                                <li><a class="text-muted" href="#">Team</a></li>
                                <li><a class="text-muted" href="#">Locations</a></li>
                            </ul>
                        </div>
                    </div>

                    <div class="row py-2 px-1 " style="background:linear-gradient(to right,#BFF098, #6FD6FF);">
                        <div class="mx-auto w-auto">
                            <span>Copyright © <a href="http://www.youzhan.org">天の使精选</a></span> |
                            <span><a href="http://www.miibeian.gov.cn/" target="_blank">ICP备11008151号</a></span>
                        </div>
                    </div>

                </div>
            </main>

        </div>
    </div>





    <div class="modal fade in " id="FAQ" tabindex="-1" role="dialog" aria-labelledby="FAQ">
        <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">Can I help U ?</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <textarea class="form-control" rows="10" placeholder="Do you have some FAQ ?"></textarea>
                </div>

                <div class="modal-footer ">
                    <button class="btn btn-primary" type="submit">Send</button>
                </div>
            </div>
        </div>
    </div>

    <!--model-登录框-->
    <div class="modal fade in " id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModal">
        <div class="modal-dialog modal-dialog-centered " role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">请登录~</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span class="fas fa-power-off"></span>
                    </button>
                </div>
                <div class="modal-body">

                    <form class="form-signin" action="{{url_for('auth.login')}}" method="post">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
                        <div class="text-center mb-4">
                            <img width="72" height="72" class="mb-4" alt=""
                                src="{{url_for('static',filename='pic/bootstrap-solid.svg')}}">
                            <h1 class="h3 mb-3 font-weight-normal">Floating labels</h1>
                            <p>Build form controls with floating labels via the <code>:placeholder-shown</code>
                                pseudo-element. <a href="https://caniuse.com/#feat=css-placeholder-shown">Works in
                                    latest Chrome, Safari, and
                                    Firefox.</a></p>
                        </div>

                        <div class="form-label-group" style="margin-bottom:1rem">
                            <input class="form-control form-control-lg" id="username1" autofocus="" required=""
                                type="text" placeholder="Username" name="username">
                            <label for="username" style="display: none">Username</label>
                        </div>

                        <div class="form-label-group" style="margin-bottom:1rem">
                            <input class="form-control form-control-lg" id="password1" required="" type="password"
                                placeholder="Password" name="password">
                            <label for="password" style="display: none">Password</label>
                        </div>

                        <div class="checkbox mb-3">
                            <label>
                                <input type="checkbox" value="remember-me"> Remember me
                                <a href="{{url_for('auth.login')}}">忘记密码?</a>
                            </label>
                        </div>
                        <input class="btn btn-lg btn-primary btn-block" type="submit" value="Submit">
                        <input type="hidden" name="next" value="" />
                    </form>
                </div>
                <div class="modal-footer">欢迎登机</div>
            </div>
        </div>
    </div>

    <script>
        feather.replace()
        var csrftoken = $("meta[name=csrf-token]").attr("content");

        function logout() {
            $.ajax({
                url: '{{url_for("auth.logout")}}',
                type: 'post',
                headers: {
                    "X-CSRFToken": csrftoken
                },
                dataType: 'json',
                success: function (data) {
                    console.log(data)
                },
                error: function (data) {
                    console.log(data);
                },
            })
        }

        function login() {
            $.ajax({
                url: '{{url_for("auth.login")}}',
                type: 'post',
                headers: {
                    "X-CSRFToken": csrftoken
                },
                dataType: 'json',
                success: function (data) {
                    console.log(data)
                },
                error: function (data) {
                    console.log(data);
                },
            })
        }
        var int = self.setInterval("auto_close()", 3500);

        function clock() {
            var d = new Date();
            var t = d.toLocaleTimeString();
            document.getElementById("clock").value = t;
        }

        function auto_close() {
            $(".alert").alert('close');
        }
        var flag = 1

        function plus() {


            if (flag) {
                $("#sidebar").css({
                    "width": '73px',
                    "transition": "width 0.2s"
                });
                $(".main").css({
                    "width": '1847px',
                    "left": "73px",
                    "transition": "width 0.1s"
                });
                $(".appbar").css({
                    "width": '1920px',
                    "left": "0px",
                    "transition": "width 0.1s"
                });
                flag = 0
                $("#open").addClass('d-none')
                $("#close").removeClass('d-none')
            } else {
                $("#sidebar").css({
                    "width": '240px',
                    "transition": "width 0.2s"
                });
                $(".main").css({
                    "width": '1680px',
                    "left": "240px",
                    "transition": "width 0.1s"
                });
                $(".appbar").css({
                    "width": '1680px',
                    "left": "240px",
                    "transition": "width 0.1s"
                });
                $("#close").addClass('d-none')
                $("#open").removeClass('d-none')
                flag = 1
            }


        }
    </script>
</body>

</html>